﻿Imports VN.INS.DL.DALC
Imports VN.INS.BL.BE

Public Class MantenimientoPoaBC

    Public Function Lista_Monitoreador(ByVal strCodPPER As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.Lista_Monitoreador(strCodPPER)
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function Lista_Especialista(ByVal strCodPPER As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.Lista_Especialista(strCodPPER)
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaEspecialistaMantPoa(ByVal strCodPPER As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.ListaEspecialistaMantPoa(strCodPPER)
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function lista_ejecutor() As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.lista_ejecutor()
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function lista_ambito() As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.lista_ambito()
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function tipo_cambio() As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.tipo_cambio()
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function Lista_Unidades() As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.Lista_Unidades()
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function lista_departamento() As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.lista_departamento()
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function lista_provincia(ByVal strUbigeo As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.lista_provincia(strUbigeo)
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function lista_distrito(ByVal strUbigeo As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.lista_distrito(strUbigeo)
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function lista_producto(ByVal ppr As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.lista_producto(ppr)
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function cargarGrilla() As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.cargarGrilla()
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Sub insertar_poa(ByVal tipCamb As String, ByVal ejec As String, ByVal doc As String, ByVal VERS As Integer, ByVal POA1 As String,
                            ByVal nomb As String, ByVal obj As String,
                            ByVal Desc_mt1 As String, ByVal mt1 As String, ByVal umt1 As String,
                            ByVal Desc_mt2 As String, ByVal mt2 As String, ByVal umt2 As String,
                            ByVal Desc_mt3 As String, ByVal mt3 As String, ByVal umt3 As String,
                            ByVal monto As Decimal, ByVal montoaño As Decimal,
                            ByVal añofirm As String, ByVal monitoreador As String, ByVal espec As String, ByVal mesfirm As String,
                            ByVal dpto As String, ByVal tipodoc As String, ByVal snip As String, ByVal fviabilidad As String, ByVal convenio As String,
                            ByVal ambit As String, ByVal estado As String, ByVal pper As String, ByVal produc As String, ByVal MontTrans As Decimal,
                            ByRef TipoAsig As String, ByVal TipoProyDes As String, ByVal COOX As String, ByVal COOY As String, ByVal OBS As String,
                            ByVal periodoIni As String, ByVal periodoFin As String, ByVal montoRO As String, ByVal montoDT As String, ByVal EstadoIngreso As String)

        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.insertar_poa(tipCamb, ejec, doc, VERS, POA1, nomb, obj, Desc_mt1, mt1, umt1, Desc_mt2, mt2, umt2, Desc_mt3, mt3, umt3, monto, montoaño, añofirm,
                                               monitoreador, espec, mesfirm, dpto, tipodoc, snip, fviabilidad, convenio, ambit, estado, pper, produc,
                                               MontTrans, TipoAsig, TipoProyDes, COOX, COOY, OBS, periodoIni, periodoFin, montoRO, montoDT, EstadoIngreso)

        Catch ex As Exception
            Throw ex
        End Try

    End Sub
    Public Sub insertar_componente(ByVal poa As String, ByVal comp As String, ByVal Descripcion As String, ByVal version As String, ByVal comph As Integer, ByVal pesocomp As Integer)
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.insertar_componente(poa, comp, Descripcion, version, comph, pesocomp)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub
    Public Sub editar_poa_principal(ByVal tipCamb As String, ByVal ejec As String, ByVal doc As String, ByVal VERS As Integer, ByVal POA1 As String,
                                    ByVal nomb As String, ByVal obj As String,
                                    ByVal Desc_mt1 As String, ByVal mt1 As String, ByVal umt1 As String,
                                    ByVal Desc_mt2 As String, ByVal mt2 As String, ByVal umt2 As String,
                                    ByVal Desc_mt3 As String, ByVal mt3 As String, ByVal umt3 As String,
                                    ByVal monto As Decimal, ByVal montoaño As Decimal,
                                    ByVal añofirm As String, ByVal monitoreador As String, ByVal espec As String, ByVal mesfirm As String,
                                    ByVal dpto As String, ByVal tipodoc As String, ByVal snip As String, ByVal fviabilidad As String,
                                    ByVal convenio As String, ByVal ambit As String, ByVal estado As String, ByVal pper As String,
                                    ByVal produc As String, ByVal MontTrans As Decimal, ByRef TipoAsig As String, ByVal TipoProyDes As String,
                                    ByVal COORDX As String, ByVal COORDY As String, ByVal OBS As String, ByVal periodoIni As String,
                                    ByVal periodoFin As String, ByVal montoRO As String, ByVal montoDT As String, ByVal EstadoIngreso As String)

        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.editar_poa_principal(tipCamb, ejec, doc, VERS, POA1, nomb, obj, Desc_mt1, mt1, umt1, Desc_mt2, mt2, umt2, Desc_mt3, mt3, umt3, monto, montoaño,
                                                       añofirm, monitoreador, espec, mesfirm, dpto, tipodoc, snip, fviabilidad, convenio, ambit,
                                                       estado, pper, produc, MontTrans, TipoAsig, TipoProyDes, COORDX, COORDY, OBS, periodoIni,
                                                       periodoFin, montoRO, montoDT, EstadoIngreso)

        Catch ex As Exception
            Throw ex
        End Try

    End Sub
    Public Sub editar_poa_componente(ByVal poa As String, ByVal comp As String, ByVal Descripcion As String, ByVal version As String, ByVal pesocomp As String)
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.editar_poa_componente(poa, comp, Descripcion, version, pesocomp)
        Catch ex As Exception
            Throw ex
        End Try

    End Sub

    Public Sub editar_poa_financiero(ByVal GENE As String, ByVal ESPEC As String, ByVal version As Integer, ByVal IDPFN As Integer,
                                         ByVal MT1 As Decimal, ByVal MT2 As Decimal, ByVal MT3 As Decimal, ByVal MT4 As Decimal, ByVal MT5 As Decimal, ByVal MT6 As Decimal,
                                         ByVal MT7 As Decimal, ByVal MT8 As Decimal, ByVal MT9 As Decimal, ByVal MT10 As Decimal, ByVal MT11 As Decimal, ByVal MT12 As Decimal,
                                         ByVal MTAF As Decimal, ByVal MT As Decimal, ByVal MEAA As Decimal, ByVal EJECUTORA As Decimal, ByVal DEVIDA As Decimal, ByVal OTROS As Decimal)
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.editar_poa_financiero(GENE, ESPEC, version, IDPFN, MT1, MT2, MT3, MT4,
                                                        MT5, MT6, MT7, MT8, MT9, MT10, MT11, MT12, MTAF, MT, MEAA, EJECUTORA, DEVIDA, OTROS)
        Catch ex As Exception
            Throw ex
        End Try

    End Sub
    Public Sub editar_poa_fisico(ByVal comp As String, ByVal Descripcion As String, ByVal version As Integer, ByVal unidad As String, ByVal IDPF As Integer,
                                        ByVal MT1 As Decimal, ByVal MT2 As Decimal, ByVal MT3 As Decimal, ByVal MT4 As Decimal, ByVal MT5 As Decimal, ByVal MT6 As Decimal,
                                        ByVal MT7 As Decimal, ByVal MT8 As Decimal, ByVal MT9 As Decimal, ByVal MT10 As Decimal, ByVal MT11 As Decimal, ByVal MT12 As Decimal,
                                        ByVal MTA As Decimal, ByVal PESO As Integer, ByVal COD As String, ByVal MT As Decimal, ByVal MEAA As Decimal)
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.editar_poa_fisico(comp, Descripcion, version, unidad, IDPF, MT1, MT2, MT3, MT4, MT5, MT6, MT7,
                                                    MT8, MT9, MT10, MT11, MT12, MTA, PESO, COD, MT, MEAA)
        Catch ex As Exception
            Throw ex
        End Try

    End Sub

    Public Function ListaPOA(ByVal strPersona As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.ListaPOA(strPersona)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaPOA(ByVal strNombre As String, ByVal strPPER As String, ByVal strEjecutor As String, ByVal strPOA As String, ByVal stranhio As String, ByVal strPersona As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.ListaPOA(strNombre, strPPER, strEjecutor, strPOA, stranhio, strPersona)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargarGrillaHistory(ByVal poa As String) As DataTable

        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.CargarGrillaHistory(poa)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargarGrillaComponente(ByVal poa As String) As DataTable

        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.CargarGrillaComponente(poa)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargarGrillafisico(ByVal poa As String) As DataTable

        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.CargarGrillafisico(poa)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargarGrillafinanciero(ByVal poa As String) As DataTable

        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.CargarGrillafinanciero(poa)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function modific_poaPrinc(ByVal poa As String) As DataTable

        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.modific_poaPrinc(poa)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function LISTA_COMPONENTE(ByVal poac As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim ObjDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjDt = ObjMantenimientoPoaDA.LISTA_COMPONENTE(poac)
            Return ObjDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Sub insertar_actividad_fisica(ByVal poa As String, ByVal comp As String, ByVal Descripcion As String, ByVal version As String, ByVal unidad As String, ByVal IDPF As Integer,
                                        ByVal MT1 As Decimal, ByVal MT2 As Decimal, ByVal MT3 As Decimal, ByVal MT4 As Decimal, ByVal MT5 As Decimal, ByVal MT6 As Decimal,
                                        ByVal MT7 As Decimal, ByVal MT8 As Decimal, ByVal MT9 As Decimal, ByVal MT10 As Decimal, ByVal MT11 As Decimal, ByVal MT12 As Decimal,
                                        ByVal MTA As Decimal, ByVal IDFH As Integer, ByVal IDPC As Integer, ByVal PESO As Integer, ByVal COD As String, ByVal MT As Decimal, ByVal MEAA As Decimal)

        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.insertar_actividad_fisica(poa, comp, Descripcion, version, unidad, IDPF,
                                         MT1, MT2, MT3, MT4, MT5, MT6, MT7, MT8, MT9, MT10, MT11, MT12, MTA, IDFH, IDPC, PESO, COD, MT, MEAA)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub insertar_actividad_financiera(ByVal poa As String, ByVal GENE As String, ByVal ESPEC As String, ByVal version As Integer, ByVal IDPFN As Integer,
                                         ByVal MT1 As Decimal, ByVal MT2 As Decimal, ByVal MT3 As Decimal, ByVal MT4 As Decimal, ByVal MT5 As Decimal, ByVal MT6 As Decimal,
                                         ByVal MT7 As Decimal, ByVal MT8 As Decimal, ByVal MT9 As Decimal, ByVal MT10 As Decimal, ByVal MT11 As Decimal, ByVal MT12 As Decimal,
                                         ByVal MTAF As Decimal, ByVal IDFNH As Integer, ByVal MT As Decimal, ByVal MEAA As Decimal, ByVal EJECUTORA As Decimal, ByVal DEVIDA As Decimal, ByVal OTROS As Decimal)

        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.insertar_actividad_financiera(poa, GENE, ESPEC, version, IDPFN,
                                          MT1, MT2, MT3, MT4, MT5, MT6, MT7, MT8, MT9, MT10, MT11, MT12,
                                          MTAF, IDFNH, MT, MEAA, EJECUTORA, DEVIDA, OTROS)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Function Listaidcompohistory(ByVal compoH As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.Listaidcompohistory(compoH)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function lista_GENERICA() As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.lista_GENERICA
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function lista_ESPECIFICA(ByVal generica As String) As DataTable
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            objDt = ObjMantenimientoPoaDA.lista_ESPECIFICA(generica)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function lista_ESPECIFICA2(ByVal generica As String) As DataTable
        Dim Objlista_ESPECIFICA2DA As MantenimientoPoaDA
        Dim objDt As DataTable

        Try
            Objlista_ESPECIFICA2DA = New MantenimientoPoaDA
            objDt = Objlista_ESPECIFICA2DA.lista_ESPECIFICA2(generica)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function TipoTransferencia() As DataTable
        Dim objTT As MantenimientoPoaDA
        Dim obdt As DataTable
        Try
            objTT = New MantenimientoPoaDA
            obdt = objTT.TipoTransferencia()
            Return obdt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function TipoProyectoDES() As DataTable
        Dim objTPD As MantenimientoPoaDA
        Dim objdt As DataTable
        Try
            objTPD = New MantenimientoPoaDA
            objdt = objTPD.TipoProyectoDES()
            Return objdt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ExistenciaComponente(ByVal strcomponente As Integer) As DataTable
        Dim objdata As MantenimientoPoaDA
        Dim objdt As DataTable
        Try
            objdata = New MantenimientoPoaDA
            objdt = objdata.ExistenciaComponente(strcomponente)
            Return objdt

        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargaComponenteEdicion(ByVal strPOA As String, ByVal strVersion As String) As DataTable
        Dim objdata As MantenimientoPoaDA
        Dim objdt As DataTable
        Try
            objdata = New MantenimientoPoaDA
            objdt = objdata.CargaComponenteEdicion(strPOA, strVersion)
            Return objdt

        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function CargaFisicoEdicion(ByVal strPOA As String, ByVal strVersion As String) As DataTable
        Dim objdata As MantenimientoPoaDA
        Dim objdt As DataTable
        Try
            objdata = New MantenimientoPoaDA
            objdt = objdata.CargaFisicoEdicion(strPOA, strVersion)
            Return objdt

        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Sub EditarCodigoComponente(ByVal strCodigo As String, ByVal strComponente As String, ByVal strPOA As String, ByVal strVersion As String)
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.EditarCodigoComponente(strCodigo, strComponente, strPOA, strVersion)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Sub EditarCodigoFisico(ByVal strComponente As String, ByVal strPOA As String, ByVal strIPAF As String, ByVal strVersion As String, ByVal strCodigo As String)
        Dim ObjMantenimientoPoaDA As MantenimientoPoaDA
        Try
            ObjMantenimientoPoaDA = New MantenimientoPoaDA
            ObjMantenimientoPoaDA.EditarCodigoFisico(strComponente, strPOA, strIPAF, strVersion, strCodigo)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub
End Class
